﻿using System;
using System.Collections.Generic;
using Coleotrack.Core.Helper;
using Coleotrack.Data;
using Coleotrack.Service.Contracts;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using StructureMap;

namespace Coleotrack.Service.Registration
{
    public class ExposeConfiguration : IExposeConfiguration
    {
        private readonly bool createSchema;

        public ExposeConfiguration(bool createSchema)
        {
            this.createSchema = createSchema;
        }

        public void Expose(Configuration configuration)
        {
            if (createSchema)
            {
                var schemaExport = new SchemaExport(configuration);
                schemaExport.Drop(true, true);
                schemaExport.Create(true, true);
            }
        }
    }
}